import { _decorator, Component, Node, Layout } from 'cc';
import List from '../../ccc3-framework-core/framework/extends/ListView/List';
import { entityUtil } from '../../ccc3-framework-core/framework/modules/entityUtil';
import { framingLoadingUtil } from '../../ccc3-framework-core/framework/modules/framingLoadingUtil';
import { UiForm } from '../../ccc3-framework-core/framework/ui/uiForm';
import { BannerOptions } from '../../ccc3-framework-core/platform/BannerOptions';
import { platformUtil } from '../../ccc3-framework-core/platform/platformUtil';
import { LeveLCfg } from '../../sheets/vo/LeveLCfg';
import { BundlesDefine } from '../CustomDefine';
import { mapItemRender } from './mapItemRender';
const { ccclass, property } = _decorator;

@ccclass('mapForm')
export class mapForm extends UiForm {

    @property(Layout)
    public mapList: Layout;

    start() {

    }

    public onEnable() {
        let mapAll = LeveLCfg.getAll();
        entityUtil.hideAllEntity("mapItemRender");
        framingLoadingUtil.framingLoad(mapAll.length, (index) => {
            let mapItemData = mapAll[index];
            entityUtil.showEntity("entity/mapItemRender", this.mapList.node, (item) => {
                let mir = item.getComponent(mapItemRender);
                mir.data = mapItemData;
                mir.dataChanged();
            }, BundlesDefine.main)
        })

        // let options = new BannerOptions();
        // platformUtil.currentPlatform.showBanner(options);
    }

    public onDisable() {
        // platformUtil.currentPlatform.hideBanner(false);
    }



    update(deltaTime: number) {

    }
}

